<!DOCTYPE html>
<html>
<head>
    <include file="./public/sty.html"/>
	<link href="/style/css/city-picker.css" rel="stylesheet">
	<link href="/style/css/main.css" rel="stylesheet">
	<style>
		#distpicker{float: left; width: 360px;}
		#distpicker .title{ width: 320px; text-align: left; border: none;}
		#distpicker .city-picker-span{border:1px solid #ccc ; text-indent: 6px; height:32px !important; line-height: 32px;}
		#distpicker .city-picker-span .placeholder{height:32px !important; line-height: 32px;}
	</style>
	<style>
		.yz1,.yz2,.yz3,.yz4,.yz5,.yz6{text-align: left !important; margin-left: 20px;}
		.yz1 :before,.yz2 :before,.yz3 :before,.yz4 :before,.yz5 :before,.yz6 :before{ font-family: iconfont;
			font-style: inherit;
			padding: 0 5px;
			font-size: 14px;content: "\E60D";}
	</style>
</head>
<body>
<div id="app" class="manageBankcard">
    <include file="./public/header.html"/>

    <div class="container pt15 fix" s="[object Object]">
        <div class="slideUser">
            <ul class="sildeSession"><h3><span></span>账号管理</h3>
                <li class=""><a href="{:U('Users/personalInfo')}">个人信息</a></li>
                <li class="curr"><a href="{:U('Users/securityCenter')}">安全中心</a></li>
                <li class=""><a href="{:U('Users/manageBankcard2')}">银行卡管理</a></li>
            </ul>
            <ul class="sildeSession"><h3><span></span>投注管理</h3>
                <li><a href="{:U('Users/BetRecord')}" class="">投注记录</a></li>
                <li><a href="{:U('Users/seekOrder')}" class="">追号记录</a></li>
            </ul>
            <ul class="sildeSession"><h3><span></span>资金管理</h3>
                <li><a href="{:U('Users/BillRecord')}" class="">交易记录</a></li>
                <li class=""><a href="{:U('Users/PLstatement')}">今日盈亏</a></li>
            </ul>
			<ul class="sildeSession">
				<h3><span></span>代理中心</h3>
				<li><a href="{:U('Users/agentIntro')}" class="">代理说明</a></li>
				<li class=""><a href="{:U('Users/agentReport')}">代理报表</a></li>
				<li><a href="{:U('Users/lowerReport')}" class="">下级报表</a></li>
				<li class=""><a href="{:U('Users/manageInvite')}">下级开户</a></li>
				<li><a href="{:U('Users/agentMember')}" class="">会员管理</a></li>
				<li><a href="{:U('Users/agentBetRecord')}" class="">投注明细</a></li>
				<li><a href="{:U('Users/agentBillRecord')}" class="">交易明细</a></li>
			</ul>
            <ul class="sildeSession"><h3><span></span>消息管理</h3>
                <li><a href="{:U('Users/letter')}" class="">站内信</a></li>
                <li><a href="{:U('Users/Notice')}" class="">网站公告</a></li>
            </ul>
        </div>
		<!-- 添加 -->
		<form action="{:U('Users/manageBankcard_upd',array('id'=>$v['id']))}" method="post" enctype="multipart/form-data" id="form">

		<div data-v-30c57826="" class="userRight next_bank" >
			<div data-v-30c57826="" class="userTitle mgb10">绑定银行卡</div>
			<div data-v-30c57826="" class="userMain mgb10">
				<ul data-v-30c57826="" class="submitContent mg30 setBankcard">
					<foreach name="aa" item="v">
						<input type="hidden" name="id" id="uid" value="{$v.id}">
					<li data-v-30c57826=""><span data-v-30c57826="">开户银行：</span>
						<select class="diyselect sb" name="yinhang" id="yinhang" style="width: 355px; height: 30px;" >
							    <option data-v-30c57826="" class="selected" value="">请选择银行</option>
								<option value="1" <?php if($v["bankid"]=='1')echo "selected"; ?>>工商银行</option>
								<option value="2" <?php if($v["bankid"]=='2')echo "selected"; ?>>建设银行</option>
								<option value="3" <?php if($v["bankid"]=='3')echo "selected"; ?>>农业银行</option>
								<option value="4" <?php if($v["bankid"]=='4')echo "selected"; ?>>民生银行</option>
								<option value="5" <?php if($v["bankid"]=='5')echo "selected"; ?>>招商银行</option>
								<option value="6" <?php if($v["bankid"]=='6')echo "selected"; ?>>交通银行</option>
								<option value="7" <?php if($v["bankid"]=='7')echo "selected"; ?>>中国银行</option>
								<option value="8" <?php if($v["bankid"]=='8')echo "selected"; ?>>邮政储蓄</option>
								<option value="9" <?php if($v["bankid"]=='9')echo "selected"; ?>>中信银行</option>
								<option value="10" <?php if($v["bankid"]=='10')echo "selected"; ?>>兴业银行</option>
								<option value="11" <?php if($v["bankid"]=='11')echo "selected"; ?>>华夏银行</option>
								<option value="12" <?php if($v["bankid"]=='12')echo "selected"; ?>>浦发银行</option>
								<option value="13" <?php if($v["bankid"]=='13')echo "selected"; ?>>广发银行</option>
								<option value="14" <?php if($v["bankid"]=='14')echo "selected"; ?>>平安银行</option>
								<option value="15" <?php if($v["bankid"]=='15')echo "selected"; ?>>光大银行</option>
								<option value="16" <?php if($v["bankid"]=='16')echo "selected"; ?>>农商银行</option>
						</select><span class="yz1" style="margin-bottom: 20px"></span>
					</li>
					<li data-v-30c57826="" style="height:34px;">
						<span data-v-30c57826="" style="float: left;">开户城市：</span>
						<div id="distpicker">
							<div class="form-group">
								<div style="position: relative;">
									<input id="city-picker3"  type="text" data-toggle="city-picker" value="{$v.sheng}/{$v.shi}"  placeholder="请选择城市">
									<input type="hidden" name="province" id="province" value="{$v.province}">
									<input type="hidden" name="city" id="city" value="{$v.province}">
								</div>
							</div>
						</div><span class="yz2"></span>
					</li>
					<div style="clear: both;"></div>
					<li data-v-30c57826="">
						<span data-v-30c57826="">开户人姓名：</span>
						<input data-v-30c57826="" tag="开户人姓名" name="name" value="<?php echo trim($v['uname']); ?>" id="name" type="text" placeholder="请输入银行卡的姓名" class="userInput"><span class="yz3" style="width: 240px"></span>
					</li>
					<li data-v-30c57826="">
						<span data-v-30c57826="">银行卡号：</span>
						<input data-v-30c57826="" tag="银行卡号" type="text" id="kahao1" value="<?php echo trim($v['card']); ?>" placeholder="请输入银行卡的卡号" class="userInput"><span class="yz4"  style="width: 240px"></span>
					</li> 
					<li data-v-30c57826="">
						<span data-v-30c57826="">确认卡号：</span>
						<input data-v-30c57826="" tag="确认卡号" type="text" id="kahao2" name="kahao2"  placeholder="请再次输入银行卡号" class="userInput _no_paste"><span class="yz5"  style="width: 240px"></span>
					</li> 
					<li data-v-30c57826="">
						<span data-v-30c57826="">安全密码：</span> 
						<input data-v-30c57826="" tag="安全密码" type="text" id="mima" onfocus="this.type='password'" autocomplete="off" placeholder="请输入您的安全密码" class="userInput"><span class="yz6" style="width: 250px"></span>
						<div>
						   <a href="/ResetWay?Q=ResetSafePwd" class="" notsubmit="yes" data-v-30c57826="" style="margin-left: 150px">忘记安全密码?</a>
						</div>
					</li>
					<li data-v-30c57826="">
						<span data-v-30c57826=""></span> 
						<a data-v-30c57826="" class="submitBtn" onclick="sav()">确定</a>
					</li>
					</foreach>
				</ul>
			</div>
		</div>
	</form>
		<!-- 添加 end-->

    </div>
    <include file="./public/footer.html"/>
</div>


<script src="/style/js/bootstrap.js"></script>
<script src="/style/js/city-picker.data.js"></script>
<script src="/style/js/city-picker.js"></script>
<script src="/style/js/jquery.min.js"></script>
<script src="/style/js/fx.js"></script>
<script>
    $(function(){
        personalInfo();

		$(".add_bank").click(function(){
			$(this).parents(".userRight").hide();
			$(".next_bank").show();
		})
    })
	$("body").on("click",".city-select.city a",function(){
		$("body").click();
	})

	//保存
	function sav(){
		var id = $("#uid").val();
		var yinhang = $("#yinhang").val();
		var sheng = $('.city-picker-span .select-item:nth-of-type(1)').data("code");
		var shi = $('.city-picker-span .select-item:nth-of-type(2)').data("code");
		$("#province").val(sheng);
		$("#city").val(shi);

		var name = $("#name").val();
		var kahao1 = $("#kahao1").val();
		var kahao2 = $("#kahao2").val();
		var mima = $("#mima").val();

		if(yinhang == ''){
			$(".yz1").html("<font color='red'>请选择开户银行</font>");
			return false;
		}else {
			$(".yz1").html("");
		}
		if(shi == null){
			$(".yz2").html("<font color='red'>请选择开户城市</font>");
			return false;
		}else {
			$(".yz2").html("");
		}
		if(name == ''){
			$(".yz3").html("<font color='red'>开户人姓名不能为空</font>");
			return false;
		}else {
			$(".yz3").html("");
		}
		if(kahao1 == ''){
			$(".yz4").html("<font color='red'>银行卡号不能为空</font>");
			return false;
		}else {
			$(".yz4").html("");
		}
       if(kahao1.length < 16 || kahao1.length > 19) {
		   $(".yz4").html("<font color='red'>银行卡号长度必须在16到19之间</font>");
			return false;
		}
		var num = /^\d*$/; //全数字
		if(!num.exec(kahao1)) {
			$(".yz4").html("<font color='red'>银行卡号必须全为数字</font>");
			return false;
		}
		//开头6位
		var strBin = "10,18,30,35,37,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,58,60,62,65,68,69,84,87,88,94,95,98,99";
		if(strBin.indexOf(kahao1.substring(0, 2)) == -1) {
			$(".yz4").html("<font color='red'>银行卡号开头6位不符合规范</font>");
			return false;
		}

		if(kahao2 == ''){
			$(".yz5").html("<font color='red'>确认卡号不能为空</font>");
			return false;
		}else {
			$(".yz5").html("");
		}
		if(kahao2 != kahao1){
			$(".yz5").html("<font color='red'>两次输入的卡号不正确</font>");
			return false;
		}else {
			$(".yz5").html("");
		}

		if(mima == ''){
			$(".yz6").html("<font color='red'>安全密码不能为空</font>");
			return false;
		}else {
			$(".yz6").html("");
		}
		$.ajax({
			type: "POST",
			url: "{:U('Users/manageBankcard3')}",
			data: {'id':id,'mima':mima},
			success: function(dat){
				if(dat=='0'){
					$(".yz6").html("<font color='red'>安全密码不正确，请重新输入</font>");
				}else if(dat==1) {
					$("#form").submit();
//					window.location.href="{:U('Users/manageBankcard_upd',array('id'=>id))}";
//					window.location.href="/Users/manageBankcard_upd/id/"+id;
//					window.location.href="/Users/manageBankcard_upd/id/"+id+"/yinhang/"+yinhang+"/sheng/"+sheng+"/shi/"+shi+"/name/"+name+"/kahao2/"+kahao2;
				}
			}
		});






	}


</script>
</body>
</html>